<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>javascript 阶段</title>
    <style>
        .box {
            width: 100px;
            height: 60px;
            background-color: red;
            border-top: 20px solid #000; 
            border-left: 50px solid #000; 
            padding: 2px;
        }
    </style>
</head>
<body>
    <div class="box"></div>


    <script>

        // 获取.box标签
        var box = document.querySelector(".box");

        // 尺寸（忽略了边框）
        console.log("宽度：",box.clientWidth);// 104
        console.log("高度：",box.clientHeight);// 64

        // 边框(左/上)
        console.log("上边框：",box.clientTop);// 20
        console.log("左边框：",box.clientLeft);// 50

    </script>
</body>
</html>